﻿<cfset productid="7383756">
<cfset rootcolorid="422">
<cfset quantity="1">
<cfset rootsizeid="430">

<cfif NOT isDefined("url.cartkey")>
	<cfinvoke method="createCart" component="TshirtComponent"
			  returnvariable="cartkeyResponse">
			    
	<cfset cartkey="#cartkeyResponse.printfection_response.Carts_create.cart_key.XmlText#">
<cfelse>
	<cfset cartkey="#url.cartkey#">
</cfif>

<cfif isDefined("url.control")>
	<cfif #url.control# eq 0>
		<cfinvoke method="addproducttoCart" component="TshirtComponent"
			  cartkey="#cartkey#"
			  productid="#productid#"
			  rootcolorid="#rootcolorid#"
			  quantity="#quantity#"
			  rootsizeid="#rootsizeid#"
			  returnvariable="addtocartResponse">
		<cfset message="#addtocartResponse.printfection_response.Carts_addProduct.XmlText#">
		<cfif message is "OK">
			<b>Product successfully added to cart !</b>
		<cfelse>
			<b>Error</b>
		</cfif>
	</cfif>
</cfif>
	

<cfif isDefined("url.control")>
	<cfif #url.control# eq 1>
		<cfinvoke method="checkout" component="TshirtComponent"
		  			cartkey="#cartkey#">
	</cfif>
</cfif>

<table>
	<tr>
	    <td>
	    	<img src="front.jpg">
	    </td>
	    <td>
	    	<img src="back.jpg">
	    </td>
	</tr>
	<tr>
	    <td>
	    	<center><b>FRONT</b></center>
	    </td>
	    <td>
	    	<center><b>BACK</b></center>
	    </td>
	</tr>
	<tr>
		<td>
			<cfoutput>
            	<cfif isDefined("url.control")>
					<cfif #url.control# eq 1>
						<a href="index.cfm?control=0&cartkey=#cartkey#">Add to cart</a>&nbsp;&nbsp;&nbsp;&nbsp;
					</cfif>
					<cfif #url.control# eq 0>
						<a href="index.cfm?control=1&cartkey=#cartkey#">Buy</a>
					</cfif>
				<cfelse>
					<a href="index.cfm?control=0&cartkey=#cartkey#">Add to cart</a>
				</cfif>	
            </cfoutput>			
		</td>
	</tr>
</table>	